﻿// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "SElementUISlate.h"

/**
 * 
 */
class ELEMENTUISLATE_API SFilletButton : public SElementUISlate
{
public:
SLATE_BEGIN_ARGS(SFilletButton) :
		_Content()
		, _Text()
		, _TextColor(FLinearColor::White)
		, _HAlign(HAlign_Center)
		, _VAlign(VAlign_Center)
		{}

		SLATE_DEFAULT_SLOT(FArguments, Content)
		SLATE_ATTRIBUTE(FText, Text)
		SLATE_ARGUMENT(FLinearColor, TextColor)
		SLATE_ARGUMENT(EHorizontalAlignment, HAlign)
		SLATE_ARGUMENT(EVerticalAlignment, VAlign)
		SLATE_ARGUMENT(FSlateFontInfo, TextFont)
		SLATE_ARGUMENT(bool, Disabled)
		SLATE_EVENT(FOnClicked, OnClicked)
		SLATE_EVENT(FSimpleDelegate, OnHovered)
		SLATE_EVENT(FSimpleDelegate, OnUnhovered)

	SLATE_END_ARGS()

	/** Constructs this widget with InArgs */
	void Construct(const FArguments& InArgs);

	void SetBorderImage(const FSlateBrush* IconBrush);
	void ResetButton();
	void SetText(const FText& value);
	void SetTextFont(const FSlateFontInfo& value);
	void SetTextColorAndOpacity(const FLinearColor& value);
	void HideDefaultSlate();
	void ShowDefaultSlate();

	virtual void SetContentPadding(const FMargin& value) override;
	virtual void SetHAlign(EHorizontalAlignment value) override;
	virtual void SetVAlign(EVerticalAlignment value) override;
	virtual void SetContent(TSharedRef<SWidget> InContent) override;
private:
	TSharedPtr<SButton> Button;
	TSharedPtr<SBorder> ButtonBorder;
	TSharedPtr<STextBlock> ButtonText;
	TAttribute<FText> Text;
	FSlateFontInfo TextFont;
};
